// 按需导入element-plus组件
import { App } from 'vue';
import {
  ElDialog,
  ElButton,
  ElInput,
  ElSelect,
  ElTable,
  ElTableColumn,
  ElPagination,
  ElMessage,
  ElMessageBox,
  ElMenu,
  ElMenuItem,
  ElSubmenu,
  ElTabs,
  ElTabPane,
  ElPageHeader,
  ElDropdown,
  ElDrawer,
  ElTooltip,
  ElPopover
} from 'element-plus';

// 国际化
import 'dayjs/locale/zh-cn';
import locale from 'element-plus/lib/locale';
import lang from 'element-plus/lib/locale/lang/zh-cn';
locale.use(lang);

export default (app: App) => {
  app.config.globalProperties.$message = ElMessage;
  app.config.globalProperties.$msgbox = ElMessageBox;
  app.config.globalProperties.$confirm = ElMessageBox.confirm;

  app.component(ElDialog.name, ElDialog);
  app.component(ElButton.name, ElButton);
  app.component(ElInput.name, ElInput);
  app.component(ElSelect.name, ElSelect);
  app.component(ElTable.name, ElTable);
  app.component(ElTableColumn.name, ElTableColumn);
  app.component(ElPagination.name, ElPagination);
  app.component(ElMenu.name, ElMenu);
  app.component(ElSubmenu.name, ElSubmenu);
  app.component(ElMenuItem.name, ElMenuItem);
  app.component(ElTabs.name, ElTabs);
  app.component(ElTabPane.name, ElTabPane);
  app.component(ElPageHeader.name, ElPageHeader);
  app.component(ElDropdown.name, ElDropdown);
  app.component(ElDrawer.name, ElDrawer);
  app.component(ElTooltip.name, ElTooltip);
  app.component(ElPopover.name, ElPopover);
};
